cmake_minimum_required(VERSION 3.16)
project (quickjs)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
    message("==>>Debug Model")
    SET(CMAKE_VERBOSE_MAKEFILE ON)
    add_definitions("-Wall -Wno-sign-compare -g -march=native -Wno-strict-aliasing -Wno-comment")
else()
    message("==>>Release Model")
    add_definitions("-Wall -Wno-sign-compare -O3 -march=native -Wno-strict-aliasing -Wno-comment")
endif()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(cmake/QuickJSGen.cmake)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

#-------------------------------------------------------------------------------
# Set include paths and library paths.
#-------------------------------------------------------------------------------
message("==>>${PROJECT_SOURCE_DIR}/include")
include_directories(
        ${PROJECT_SOURCE_DIR}/include
        ${PROJECT_SOURCE_DIR}/src
)
add_definitions(-DTHREADED)
link_directories(
        ${PROJECT_SOURCE_DIR}/lib
)
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
    SET(PALT_NAME "linux")
ELSE()
    SET(PALT_NAME "windows")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

add_subdirectory(src)